package org.xtframe.sql.verify;

import java.util.List;
import java.util.Map;

import org.xtframe.sql.PreparedParameter;
import org.xtframe.sql.SqlDataVerify.VerifyType;
import org.xtframe.sql.VerifyBase;

public class PreparedVerify implements VerifyBase {
	private String position = "";
	
	private int sequen = -1;

	public void init(Map<String, Object> data) {
		if(data.containsKey("position")) this.position = data.get("position").toString();
		if(data.containsKey("sequen")) this.sequen = Integer.valueOf(data.get("sequen").toString());
	}

	public String getPosition() {
		return this.position;
	}

	public VerifyType getXtype() {
		return VerifyType.replace;
	}

	public boolean check(Map<String, Object> parameters) {
		return false;
	}

	public String replace(Map<String, Object> parameters, List<PreparedParameter> preparedParameters) {
		String o = parameters.get(position).toString();
		preparedParameters.add(new PreparedParameter("string", sequen, o));
		return "?";
	}
}
